**************************
***** ONLNE APPENDIX *****
**************************

/***

Program Code: "Prostitution or Marriage? Evidence from the Nordic Model" (Huasheng Gao, Vanya Petrova & Mengfan Yin)
Date: this version: 2025/6/21
STATA version: 18.0


***/


******************************************************************************
****** TABLE IA1: Alternative Difference-in-Differences Methods ******
******************************************************************************

*************Panel A: Marriage rate*******************************************
use "FinalSample.dta",clear

***Dummy for pre and post distance from policy year***
gen distance=year-policy_year
tab distance, missing

drop if distance<-15 & distance!=.
drop if distance>15 & distance!=.

forvalues i=1/15 { 
gen d_`i'=0 
replace d_`i'=treated if treated==1 & distance== -`i'
}
forvalues i=0/15 { 
gen d`i'=0 
replace d`i'=treated if treated==1 & distance== `i'
}

gen post=d1+d2+d3+d4+d5+d6+d7+d8+d9+d10+d11+d12+d13+d14+d15

******Sun and Abraham (2021)**********
replace policy_year=0 if policy_year==.
eventstudyinteract marriagerate d_1-d_15 post, absorb(i.countryID i.year) cohort(policy_year) control_cohort(control) vce(cluster country)

*****Borusyak et al. (2024)**********
replace policy_year=. if policy_year==0
did_imputation marriagerate countryID year policy_year, fe(countryID year) cluster(country)

******Stacked**********
replace policy_year=0 if policy_year==.
stackedev marriagerate d_1-d_15 post,cohort(policy_year) time(year) never_treat(control) unit_fe(countryID) clust_unit(countryID) 


*************Panel B: Divorce rate*******************************************
use "FinalSample.dta",clear

***Dummy for pre and post distance from policy year***
gen distance=year-policy_year
tab distance, missing

drop if distance<-15 & distance!=.
drop if distance>15 & distance!=.

forvalues i=1/15 { 
gen d_`i'=0 
replace d_`i'=treated if treated==1 & distance== -`i'
}
forvalues i=0/15 { 
gen d`i'=0 
replace d`i'=treated if treated==1 & distance== `i'
}

gen post=d1+d2+d3+d4+d5+d6+d7+d8+d9+d10+d11+d12+d13+d14+d15

******Sun and Abraham (2021)**********
replace policy_year=0 if policy_year==.
eventstudyinteract divorceper100 d_1-d_15 post, absorb(i.countryID i.year) cohort(policy_year) control_cohort(control) vce(cluster country)

*****Borusyak et al. (2024)**********
replace policy_year=. if policy_year==0
did_imputation divorceper100 countryID year policy_year, fe(countryID year) cluster(country)

******Stacked**********
replace policy_year=0 if policy_year==.
stackedev divorceper100 d_1-d_15 post,cohort(policy_year) time(year) never_treat(control) unit_fe(countryID) clust_unit(countryID) 


*******************************************************************************
* TABLE IA2: Correction for a Small Number of Clusters: Wild Cluster Bootstrap
*******************************************************************************
use "FinalSample.dta",clear

*************Panel A: Marriage rate*******************************************
regress marriagerate nordic GDPCapita populationGRT sexratio1564 i.year i.countryID, robust cluster(country) 
local vars = ustrregexra("`e(cmdline)'", "regress `e(depvar)'|i.year|i.country|robust|\,|cluster\(|country|\)", "")
    boottest nordic, cluster(country) nograph ptype(equaltail) reps(500) weighttype(normal) nonull seed(123) 
	
regress marriagerate nordic GDPCapita populationGRT sexratio1564 i.year i.countryID, robust cluster(country) 
local vars = ustrregexra("`e(cmdline)'", "regress `e(depvar)'|i.year|i.country|robust|\,|cluster\(|country|\)", "")
    boottest nordic, cluster(country) nograph reps(500) weighttype(normal) nonull seed(123)

regress marriagerate nordic GDPCapita populationGRT sexratio1564 i.year i.countryID, robust cluster(country) 
local vars = ustrregexra("`e(cmdline)'", "regress `e(depvar)'|i.year|i.country|robust|\,|cluster\(|country|\)", "")
    boottest nordic, cluster(country year) nograph ptype(equaltail) reps(500) weighttype(normal) nonull seed(123)

regress marriagerate nordic GDPCapita populationGRT sexratio1564 i.year i.countryID, robust cluster(country) 
local vars = ustrregexra("`e(cmdline)'", "regress `e(depvar)'|i.year|i.country|robust|\,|cluster\(|country|\)", "")
    boottest nordic, cluster(country year) nograph reps(500) weighttype(normal) nonull seed(123)
	
*************Panel B: Divorce rate*******************************************	
regress divorceper100 nordic GDPCapita populationGRT sexratio1564 i.year i.countryID, robust cluster(country) 
local vars = ustrregexra("`e(cmdline)'", "regress `e(depvar)'|i.year|i.country|robust|\,|cluster\(|country|\)", "")
    boottest nordic, cluster(country) nograph ptype(equaltail) reps(500) weighttype(normal) nonull seed(123) 
	
regress divorceper100 nordic GDPCapita populationGRT sexratio1564 i.year i.countryID, robust cluster(country) 
local vars = ustrregexra("`e(cmdline)'", "regress `e(depvar)'|i.year|i.country|robust|\,|cluster\(|country|\)", "")
    boottest nordic, cluster(country) nograph reps(500) weighttype(normal) nonull seed(123)
	
regress divorceper100 nordic GDPCapita populationGRT sexratio1564 i.year i.countryID, robust cluster(country) 
local vars = ustrregexra("`e(cmdline)'", "regress `e(depvar)'|i.year|i.country|robust|\,|cluster\(|country|\)", "")
    boottest nordic, cluster(country year) nograph ptype(equaltail) reps(500) weighttype(normal) nonull seed(123) 	

regress divorceper100 nordic GDPCapita populationGRT sexratio1564 i.year i.countryID, robust cluster(country) 
local vars = ustrregexra("`e(cmdline)'", "regress `e(depvar)'|i.year|i.country|robust|\,|cluster\(|country|\)", "")
    boottest nordic, cluster(country year) nograph reps(500) weighttype(normal) nonull seed(123)

*******************************************************************************
* TABLE IA3: Additional Control Variables
*******************************************************************************
use "FinalSample.dta",clear

xi:reghdfe marriagerate nordic migrant_population migrantflow_population GDPCapita populationGRT sexratio1564,absorb(country year) vce(cluster country)
eststo
xi:reghdfe divorceper100 nordic migrant_population migrantflow_population GDPCapita populationGRT sexratio1564,absorb(country year) vce(cluster country)
eststo
xi:reghdfe marriagerate nordic samesexmarriage GDPCapita populationGRT sexratio1564,absorb(country year) vce(cluster country)
eststo
xi:reghdfe divorceper100 nordic samesexmarriage GDPCapita populationGRT sexratio1564,absorb(country year) vce(cluster country)
eststo
xi:reghdfe marriagerate nordic population_med GDPCapita populationGRT sexratio1564,absorb(country year) vce(cluster country)
eststo
xi:reghdfe divorceper100 nordic population_med GDPCapita populationGRT sexratio1564,absorb(country year) vce(cluster country)
eststo

esttab using "tableIA3.rtf",  ar2 b(3) starlevels(* 0.10 ** 0.05 *** 0.01) ///
          replace nogap label nodepvars  ///
          title({\i Table IA:  Additional Control Variables})	  
eststo clear 

*******************************************************************************
* TABLE IA4: Resampling the Control Group
*******************************************************************************
use "FinalSample.dta",clear

*************Panel A: Marriage Rate When Removing Controlling Countries One by One*******************************************
xi:reghdfe marriagerate nordic GDPCapita populationGRT sexratio1564 if country!="Austria",absorb(country year) vce(cluster country)
eststo
xi:reghdfe marriagerate nordic GDPCapita populationGRT sexratio1564 if country!="Belgium",absorb(country year) vce(cluster country)
eststo
xi:reghdfe marriagerate nordic GDPCapita populationGRT sexratio1564 if country!="Denmark",absorb(country year) vce(cluster country)
eststo
xi:reghdfe marriagerate nordic GDPCapita populationGRT sexratio1564 if country!="Finland",absorb(country year) vce(cluster country)
eststo
xi:reghdfe marriagerate nordic GDPCapita populationGRT sexratio1564 if country!="Germany",absorb(country year) vce(cluster country)
eststo
xi:reghdfe marriagerate nordic GDPCapita populationGRT sexratio1564 if country!="Greece",absorb(country year) vce(cluster country)
eststo
xi:reghdfe marriagerate nordic GDPCapita populationGRT sexratio1564 if country!="Italy",absorb(country year) vce(cluster country)
eststo
xi:reghdfe marriagerate nordic GDPCapita populationGRT sexratio1564 if country!="Luxembourg",absorb(country year) vce(cluster country)
eststo
xi:reghdfe marriagerate nordic GDPCapita populationGRT sexratio1564 if country!="Netherlands",absorb(country year) vce(cluster country)
eststo
xi:reghdfe marriagerate nordic GDPCapita populationGRT sexratio1564 if country!="Portugal",absorb(country year) vce(cluster country)
eststo
xi:reghdfe marriagerate nordic GDPCapita populationGRT sexratio1564 if country!="Spain",absorb(country year) vce(cluster country)
eststo
xi:reghdfe marriagerate nordic GDPCapita populationGRT sexratio1564 if country!="Switzerland",absorb(country year) vce(cluster country)
eststo

esttab using "tableIA4-A.rtf",  ar2 b(3) starlevels(* 0.10 ** 0.05 *** 0.01) ///
          replace nogap label nodepvars  ///
          title({\i Table IA4-A: Marriage Rate When Removing Controlling Countries One by One})	  
eststo clear 

*************Panel B: Divorce Rate When Removing Controlling Countries One by One*******************************************
xi:reghdfe divorceper100 nordic GDPCapita populationGRT sexratio1564 if country!="Austria",absorb(country year) vce(cluster country)
eststo
xi:reghdfe divorceper100 nordic GDPCapita populationGRT sexratio1564 if country!="Belgium",absorb(country year) vce(cluster country)
eststo
xi:reghdfe divorceper100 nordic GDPCapita populationGRT sexratio1564 if country!="Denmark",absorb(country year) vce(cluster country)
eststo
xi:reghdfe divorceper100 nordic GDPCapita populationGRT sexratio1564 if country!="Finland",absorb(country year) vce(cluster country)
eststo
xi:reghdfe divorceper100 nordic GDPCapita populationGRT sexratio1564 if country!="Germany",absorb(country year) vce(cluster country)
eststo
xi:reghdfe divorceper100 nordic GDPCapita populationGRT sexratio1564 if country!="Greece",absorb(country year) vce(cluster country)
eststo
xi:reghdfe divorceper100 nordic GDPCapita populationGRT sexratio1564 if country!="Italy",absorb(country year) vce(cluster country)
eststo
xi:reghdfe divorceper100 nordic GDPCapita populationGRT sexratio1564 if country!="Luxembourg",absorb(country year) vce(cluster country)
eststo
xi:reghdfe divorceper100 nordic GDPCapita populationGRT sexratio1564 if country!="Netherlands",absorb(country year) vce(cluster country)
eststo
xi:reghdfe divorceper100 nordic GDPCapita populationGRT sexratio1564 if country!="Portugal",absorb(country year) vce(cluster country)
eststo
xi:reghdfe divorceper100 nordic GDPCapita populationGRT sexratio1564 if country!="Spain",absorb(country year) vce(cluster country)
eststo
xi:reghdfe divorceper100 nordic GDPCapita populationGRT sexratio1564 if country!="Switzerland",absorb(country year) vce(cluster country)
eststo

esttab using "tableIA4-B.rtf",  ar2 b(3) starlevels(* 0.10 ** 0.05 *** 0.01) ///
          replace nogap label nodepvars  ///
          title({\i Table IA4-B: Divorce Rate When Removing Controlling Countries One by One})	  
eststo clear 


*************Panel C: Additional Control Countries: Lithuania, Latvia, Estonia, Slovenia, Croatia, and the UK*******************************************
use "ExtendedSample.dta",clear

xi:reghdfe marriagerate nordic GDPCapita populationGRT sexratio1564,absorb(country year) vce(cluster country)
eststo
xi:reghdfe divorceper100 nordic GDPCapita populationGRT sexratio1564,absorb(country year) vce(cluster country)
eststo

esttab using "tableIA4-C.rtf",  ar2 b(3) starlevels(* 0.10 ** 0.05 *** 0.01) ///
          replace nogap label nodepvars  ///
          title({\i Table IA4-C: Additional Control Countries: Lithuania, Latvia, Estonia, Slovenia, Croatia, and the UK})	  
eststo clear


*************Panel D: Treated Countries Only*******************************************
use "FinalSample.dta",clear

xi:reghdfe marriagerate nordic GDPCapita populationGRT sexratio1564 if year>=1980 & (country=="Sweden"|(country=="Norway"&year<2009)|(country=="Iceland"&year<2009)|(country=="France"&year<2016)|(country=="Ireland"&year<2017)),absorb(country year) vce(cluster country)
eststo
xi:reghdfe divorceper100 nordic GDPCapita populationGRT sexratio1564 if year>=1980 & (country=="Sweden"|(country=="Norway"&year<2009)|(country=="Iceland"&year<2009)|(country=="France"&year<2016)|(country=="Ireland"&year<2017)),absorb(country year) vce(cluster country)
eststo

esttab using "tableIA4-D.rtf",  ar2 b(3) starlevels(* 0.10 ** 0.05 *** 0.01) ///
          replace nogap label nodepvars  ///
          title({\i Table IA4-D: Treated Countries Only})	  
eststo clear 

*******************************************************************************
* TABLE IA5: Resampling the Treated Group
*******************************************************************************
use "FinalSample.dta",clear

****TABLE IA5 (1) & (2): Exclude France and Ireland*****************************
xi:reghdfe marriagerate nordic GDPCapita populationGRT sexratio1564 if country!="France"&country!="Ireland",absorb(country year) vce(cluster country)
eststo
xi:reghdfe divorceper100 nordic GDPCapita populationGRT sexratio1564 if country!="France"&country!="Ireland",absorb(country year) vce(cluster country)
eststo

****TABLE IA5 (3) & (4): Exclude Sweden*****************************
xi:reghdfe marriagerate nordic GDPCapita populationGRT sexratio1564 if country!="Sweden",absorb(country year) vce(cluster country)
eststo
xi:reghdfe divorceper100 nordic GDPCapita populationGRT sexratio1564 if country!="Sweden",absorb(country year) vce(cluster country)
eststo

esttab using "tableIA5.rtf",  ar2 b(3) starlevels(* 0.10 ** 0.05 *** 0.01) ///
          replace nogap label nodepvars  ///
          title({\i Table IA5:  Resampling the Treated Group})	  
eststo clear 


*******************************************************************************
* TABLE IA6: Alternative Measures of Divorce Rates
*******************************************************************************
use "FinalSample.dta",clear

xi:reghdfe divorcerate nordic GDPCapita populationGRT sexratio1564,absorb(country year) vce(cluster country)
eststo
xi:reghdfe netdivorce nordic GDPCapita populationGRT sexratio1564,absorb(country year) vce(cluster country)
eststo

esttab using "tableIA6.rtf",  ar2 b(3) starlevels(* 0.10 ** 0.05 *** 0.01) ///
          replace nogap label nodepvars  ///
          title({\i Table IA6:  Alternative Measures of Divorce Rates})	  
eststo clear 


*******************************************************************************
* TABLE IA7 Panel B: Baseline Results Based on Common Restricted Sample
*******************************************************************************
use "FinalSample.dta",clear

// **Common restricted sample***
local mainvar "marriagerate divorceper100 marriagerate_fsingle marriagerate_fnonsingle marriagerate_msingle marriagerate_mnonsingle marriagerate_f30under marriagerate_f30over marriagerate_m30under marriagerate_m30over unilateraldummy cohab_regulation highstrongmarriage highmean_GPG_under35 highmean_PorvGap"
gen commonsample=1
foreach v of local mainvar{
replace commonsample=0 if `v'==.
}

xi:reghdfe marriagerate nordic GDPCapita populationGRT sexratio1564 if commonsample==1,absorb(country year) vce(cluster country)
eststo
xi:reghdfe divorceper100 nordic GDPCapita populationGRT sexratio1564 if commonsample==1,absorb(country year) vce(cluster country)
eststo

esttab using "tableIA7-B.rtf",  ar2 b(3) starlevels(* 0.10 ** 0.05 *** 0.01) ///
          replace nogap label nodepvars  ///
          title({\i Table IA7-B:  Baseline Results Based on Common Restricted Sample})	  
eststo clear 








